#include <stdio.h>
#define MAX 65535 
int main() {
    int i = 2, n, fab[MAX];

    scanf("%d", &n);
    fab[0] = 0;
    fab[1] = 1;
    if (n < 2) {
        printf("%d\n", fab[n]);
    } else {
        do {
            fab[i] = fab[i - 1] + fab[i - 2];
        } while (fab[i++] < n);
        printf("%d\n", fab[i - 1]);
    }

    return 0;
}
